package org.hilo.game.pages;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;

public class Guess {

	@Property
	private int guess;
	
	@Persist
	private int target;
	
	Object initialize(int target){
		this.target=target;
		this.count=0;
		
		return this;
	}
	
	public int getTarget(){
		return target;
	}
	
	@Persist
	@Property
	private int count;
	
	
	
	@Persist
	@Property
	private String message;
	
	@InjectPage
	private GameOver gameOver;
	
	
	
	
	Object onActionFromLink2(int guess){
		
		count ++;

		if (guess==target) return gameOver.initialize(count); 
			
		
		if (guess<target){
		message="zu low";}
		else{
			message="zuHi";}
		
		return null;
	}

}
